<!DOCTYPE HTML>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0, minimum-scale=1.0, user-scalable=0, initial-scale=1.0, width=device-width" />
    <meta name="format-detection" content="telephone=no, email=no, date=no, address=no">
    <title>添加测点</title>
    <link rel="stylesheet" type="text/css" href="../css/mui.min.css" />
    <link rel="stylesheet" type="text/css" href="../css/common.css"/>
    <link rel="stylesheet" href="../css/mui.picker.min.css">
	<style type="text/css">
    	.detail{
    		padding-right: 20px!important;
    	}
    	h5{color: #0062CC;}
    	.mui-navigate-right .mui-col-xs-8{
		    width: 62.666667%!important;
    	}
    	.mui-text-right input,.mui-text-right textarea{
    		border: 0;
    		font-size: 14px;
		    font-weight: 400;
		    color: #8f8f94;
    		margin-bottom: 0;
    		text-align: right;
    	}
    </style>
</head>

<body>
    <div class="mui-content">
		<ul class="mui-table-view mui-table-view-chevron type_list_spair">
      <li class="mui-table-view-cell detail">
				<div class="mui-table">
            <div class="mui-table-cell mui-col-xs-4">
              <h5 class="mui-ellipsis">测量编码：</h5>
            </div>
            <div class="mui-table-cell mui-col-xs-8 mui-text-right">
              <span class="pointnum" id="pointnum"></span>
            </div>
        </div>
			</li>
			<li class="mui-table-view-cell detail">
				<div class="mui-table">
            <div class="mui-table-cell mui-col-xs-4">
                <h5 class="mui-ellipsis">测量结果：</h5>
            </div>
            <div class="mui-table-cell mui-col-xs-8 mui-text-right">
                <input type="number" id="measurementvalue" placeholder="请输入测量结果" name="" id="" value="" />
            </div>
        </div>
			</li>
			<li class="mui-table-view-cell detail">
				<div class="mui-table mui-navigate-right">
            <div class="mui-table-cell mui-col-xs-4">
                <h5 class="mui-ellipsis">测量日期：</h5>
            </div>
            <div class="mui-table-cell mui-col-xs-8 mui-text-right" onclick="chooseTime('measure')">
                <span class="mui-h5" id="measure_day"></span>
            </div>
        </div>
			</li>
			<li class="mui-table-view-cell detail">
				<div class="mui-table mui-navigate-right">
            <div class="mui-table-cell mui-col-xs-4">
                <h5 class="mui-ellipsis">记录人：</h5>
            </div>
            <div class="mui-table-cell mui-col-xs-8 mui-text-right" onclick="chooseParson()">
                <span class="mui-h5" id="notes_parson"></span>
            </div>
        </div>
			</li>
			<li class="mui-table-view-cell detail">
				<div class="mui-table mui-navigate-right">
	                <div class="mui-table-cell mui-col-xs-4">
	                    <h5 class="mui-ellipsis">记录时间：</h5>
	                </div>
	                <div class="mui-table-cell mui-col-xs-8 mui-text-right" onclick="chooseTime('notes')">
	                    <span class="mui-h5" id="notes" ></span>
	                </div>
	           </div>
			</li>
		</ul>
    </div>
</body>
<script type="text/javascript" src="../script/api.js"></script>
<script src="../script/mui.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../script/common.js" type="text/javascript" charset="utf-8"></script>
<script src="../script/mui.picker.min.js"></script>
<script type="text/javascript">
  var userID = null;
  apiready = function () {
    $api.html($api.byId('pointnum'),api.pageParam.num)
    $api.html($api.byId('measure_day'),getCurYMDhm())
    $api.html($api.byId('notes'),getCurYMDhm())
	userID = $api.getStorage('partsInfo').loginId;
    $api.html($api.byId('notes_parson'), $api.getStorage('partsInfo').userName);
    api.addEventListener({
        name: 'ManagerCh'
    }, function(ret, err) {
      userID = ret.value.userID
      $api.html($api.byId('notes_parson'),ret.value.userName)
    });

    api.addEventListener({
      name:'navitembtn'
    },function(ret, err){
      if(ret.type == 'right'){
        if(!$api.val($api.byId('measurementvalue'))){
          Toast('请输入测量结果');
          return false
        }
        if(!$api.html($api.byId('measure_day'))){
          Toast('请输入测量日期');
          return false
        }
        if(!$api.html($api.byId('notes_parson'))){
          Toast('请选择记录人');
          return false
        }
        if(!$api.html($api.byId('notes'))){
          Toast('请输入记录时间');
          return false
        }
        ajaxrd("savePointResult",{
          pointnum:api.pageParam.num,
          measurementvalue:$api.val($api.byId('measurementvalue')),
          measuredate:$api.text($api.byId('measure_day')),
          inspector:userID,
          createdate:$api.text($api.byId('notes'))
        },function(data){
          api.sendEvent({
            name: 'successAdd',
            extra: {
              isuccess:'true'
            }
          });
          setTimeout(function(){
            api.closeWin();
          },100)
        })
      }
    })
  }
	function chooseTime(type){
    selectCommonYMDhm(function(data){
      if(type == 'measure'){
        $api.html($api.byId('measure_day'),data)
      }else{
        $api.html($api.byId('notes'),data)
      }
    })
  }
  function chooseParson (){
    openSaveWin('work_order_sel_manager','选择人员',{manager:true})
  }
</script>

</html>
